package com.cssy.xxkj.logic.dao.impl;

import com.cssy.xxkj.logic.dao.LogicProductionGetDAO;
import com.cssy.xxkj.logic.entity.LogicProductionGetDO;
import com.plat.helper.SearchConditions;

import java.util.List;

import org.springframework.dao.DataAccessException;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

/**
 * 数据访问对象实现类
 * @since 2014-10-09
 */
public class LogicProductionGetDAOImpl extends SqlMapClientDaoSupport implements LogicProductionGetDAO {

    /**
     * 插入数据
     * @param logicProductionGetDO
     * @return 插入数据的主键
     */
    public String insertLogicProductionGetDO(LogicProductionGetDO logicProductionGetDO) throws DataAccessException {
        Object id = getSqlMapClientTemplate().insert("LogicProductionGet.insert", logicProductionGetDO);
        return (String) id;
    }

    /**
     * 统计记录数
     * @param logicProductionGetDO
     * @return 查出的记录数
     */
    public Integer countLogicProductionGetDOByExample(LogicProductionGetDO logicProductionGetDO) throws DataAccessException {
        Integer count = (Integer) getSqlMapClientTemplate().queryForObject("LogicProductionGet.countByDOExample", logicProductionGetDO);
        return count;
    }

    /**
     * 更新记录
     * @param logicProductionGetDO
     * @return 受影响的行数
     */
    public Integer updateLogicProductionGetDO(LogicProductionGetDO logicProductionGetDO) throws DataAccessException {
        int result = getSqlMapClientTemplate().update("LogicProductionGet.update", logicProductionGetDO);
        return result;
    }

    /**
     * 获取对象列表
     * @param logicProductionGetDO
     * @return 对象列表
     */
    @SuppressWarnings("unchecked")
    public List<LogicProductionGetDO> findListByExample(LogicProductionGetDO logicProductionGetDO) throws DataAccessException {
        List<LogicProductionGetDO> list = getSqlMapClientTemplate().queryForList("LogicProductionGet.findListByDO", logicProductionGetDO);
        return list;
    }

    /**
     * 根据主键获取logicProductionGetDO
     * @param id
     * @return logicProductionGetDO
     */
    public LogicProductionGetDO findLogicProductionGetDOByPrimaryKey(String id) throws DataAccessException {
        LogicProductionGetDO logicProductionGetDO = (LogicProductionGetDO) getSqlMapClientTemplate().queryForObject("LogicProductionGet.findByPrimaryKey", id);
        return logicProductionGetDO;
    }

    /**
     * 删除记录
     * @param id
     * @return 受影响的行数
     */
    public Integer deleteLogicProductionGetDOByPrimaryKey(String id) throws DataAccessException {
        Integer rows = (Integer) getSqlMapClientTemplate().delete("LogicProductionGet.deleteByPrimaryKey", id);
        return rows;
    }

	@Override
	public List<LogicProductionGetDO> find(SearchConditions scs)
			throws DataAccessException {
		List<LogicProductionGetDO> list = getSqlMapClientTemplate().queryForList("LogicProductionGet_ex.find", scs);
        return list;
	}

	@Override
	public Integer count(SearchConditions scs) throws DataAccessException {
		Integer count = (Integer) getSqlMapClientTemplate().queryForObject("LogicProductionGet_ex.count", scs);
        return count;
	}

	@Override
	public Integer deleteBizRemoved(String id) throws DataAccessException {
		Integer rows = (Integer) getSqlMapClientTemplate().delete("LogicProductionGet_ex.deleteBizRemoved", id);
        return rows;
	}

}